<?php

namespace App\Http\Controllers;

use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Routing\Controller as BaseController;

class Controller extends BaseController
{
    use AuthorizesRequests, DispatchesJobs, ValidatesRequests;

    const CEIL_API_ID = 'R#40001';
    const CODE_GET_ARTICLE_TYPE_LIST = 'R#30002'; //获取文章分类接口
    const CODE_GET_ARTICLE_LIST = 'R#50001'; //获取文章列表
    const CODE_ASSET_FIND_PROJECT = 'CMS#10006'; //资产合作-找项目
    const CODE_ASSET_FIND_MONEY = 'CMS#60101'; //资产合作-找资金
    const CODE_INDUSTRY_COO_EXPERT = 'SPECIALIST#10001'; //专家
    const CODE_INDUSTRY_COO_SOLUTION = 'CMS#50102'; //解决方案
    const CODE_INDUSTRY_COO_CHAIN = 'CMS#50102'; //供应链合作

    const CODE_INDUSTRY_COO_GREEN_RESULT = 'CMS#10004'; //绿色成果
    const CODE_INFO = 'CMS-AGG#10000'; //详情接口
    const CODE_ARTICLE_LIST = 'R#50001'; //文章列表
    const CODE_MARKET_NEEDS = 'PCMT#1000011'; //市场合作中，需求列表
    const CODE_GET_NEWS_INFO = 'R#30001'; //获取新闻详情接口
    const CODE_FILTER_INFO = 'CMS#50101'; //筛选条件

    const CODE_GET_SERVICE_LIST = 'CUST#10101'; //获取服务商列表接口
    const CODE_GET_SERVICE_FILTER_LIST = 'CUST#10100'; //获取服务商筛选条件接口
    const CODE_GET_DOMAIN_TECHROUTE_LIST = 'D#50003'; //根据领域获取技术路径

    const CODE_CHECK_USER_EXIST = 'YH#10001'; //检查用户是否存在
    const CODE_USER_LOGIN = 'YH#10003'; //用户登录
    const CODE_USER_REGIST = 'YH#10002'; //用户注册
    const CODE_GET_USER_INFO = 'YH#10006'; //获取用户信息
    const CODE_UPDATE_USER_PWD = 'YH#10005'; //用户修改密码
    const CODE_UPDATE_USER_BASE_INFO = 'YH#10004'; //更新用户基本信息
    const CODE_AUTH_COMPANY_OWNER_SERVICER_INFO = 'YH#20001'; //用户公司认证
    const CODE_USER_SUBMIT_AUTH_CHECK = 'YH#20003'; //用户提交审核

    const CODE_GET_COMPANY_INFO = 'YH#20002'; //获取公司信息

    const CODE_GET_TECH_LIST = 'TECH#50001'; //获取公司技术列表
    const CODE_ADD_EDIT_COMPANY_TECH_INFO = 'TECH#50002'; //添加公司技术，修改公司技术
    const CODE_GET_TECH_INFO = 'TECH#50003'; //获取公司技术详情
    const CODE_CHECK_COMPANY_TECH_INFO = 'TECH#50005'; //用户提交技术审核
    const CODE_DEL_COMPANY_TECH_INFO = 'TECH#50004'; //删除公司技术

    const CODE_GET_COMPANY_CASE_LIS = 'CASE#40001'; //获取公司案例列表
    const CODE_ADD_EDIT_COMPANY_CASE_INFO = 'CASE#40002'; //添加公司案例,修改公司案例
    const CODE_GET_COMPANY_CASE_INFO = 'CASE#40003'; //获取公司案例详情
    const CODE_CHECK_COMPANY_CASE_INFO = 'CASE#40004'; //用户提交案例审核
    const CODE_DEL_COMPANY_CASE_INFO = 'CASE#40005'; //删除公司案例

    const CODE_GET_COMPANY_DEVICE_LIST = 'DEVICE#30001'; //获取公司设备列表
    const CODE_ADD_EDIT_COMPANY_DEVICE_INFO = 'DEVICE#30002'; //添加  修改公司设备
    const CODE_GET_COMPANY_DEVICE_INFO = 'DEVICE#30004'; //获取设备详情
    const CODE_CHECK_COMPANY_DEVICE_INFO = 'DEVICE#30009'; //提交设备审核
    const CODE_GET_COMPANY_DEVICE_INFO_BY_EDIT = 'DEVICE#30007'; //获取设备详情--编辑用
    const CODE_DEL_COMPANY_DEVICE_INFO = 'DEVICE#30005'; //删除公司设备

    const CODE_ADD_EDIT_COMPANY_DEVICE_NUMBER_INFO = 'DEVICE#30003'; //添加公司设备型号  修改公司型号
    const CODE_DEL_COMPANY_DEVICE_NUMBER_INFO = 'DEVICE#30006'; //删除设备型号

    const CODE_ADD_NEEDLE_INFO = 'DEMAND#30001'; //发布需求

    const CODE_SEND_EMAIL = 'EMAIL#10001'; //发送邮件
    const CODE_SEND_SMS = 'SMS#10001'; //发送验证码短信

    const CODE_AUTH_COMPANY_NAME = 'CUST#10003'; //公司名称相同情况认证
    //导航栏MENU
    const MENU_INDEX = 'index';
    const MENU_ABOUT = 'about';
    const MENU_TANWIN_LIB = 'tanwin_lib';
    const MENU_ASSET_COO = 'asset_coo';
    const MENU_INDUSTRY_COO = 'industry_coo';
    const MENU_MARKET_COO = 'market_coo';
    const MENU_PRODUCT_CENTER = 'product_center';
    //二级导航栏MENU
    const TAB_MENU_INDUSTRY_COO_SOLUTION = 'solution';
    const TAB_MENU_INDUSTRY_COO_EXPERT = 'expert';
    const TAB_MENU_INDUSTRY_COO_CHAIN = 'chain';
    const TAB_MENU_INDUSTRY_COO_GREEN_RESULT = 'green_result';
    const TAB_MENU_MARKET_COO_TECH = 'market_tech';
    const TAB_MENU_ABOUT_TANWIN_NEWS = 'about_tanwin_news';
    const TAB_MENU_MARKET_COO_SERVICER = 'market_servicer';
    public function returnSeoInfo($type, $title = '', $keyWord = '', $desc = '')
    {

        $seoInfo = config('seo.' . $type);
        $seoInfo['title'] = $title ? $seoInfo['title'] . ' ' . $title : $seoInfo['title'];
        $seoInfo['key_word'] = $keyWord ? $seoInfo['key_word'] . ' ' . $keyWord : $seoInfo['key_word'];
        $seoInfo['desc'] = $desc ? $seoInfo['desc'] . ' ' . $desc : $seoInfo['desc'];
        return $seoInfo;
    }
    public function returnSeoInfoAce($type, $title = '', $keyWord = '', $desc = '')
    {

        $seoInfo = config('seoAce.' . $type);
        $seoInfo['title'] = $title ? $seoInfo['title'] . ' ' . $title : $seoInfo['title'];
        $seoInfo['key_word'] = $keyWord ? $seoInfo['key_word'] . ' ' . $keyWord : $seoInfo['key_word'];
        $seoInfo['desc'] = $desc ? $seoInfo['desc'] . ' ' . $desc : $seoInfo['desc'];
        return $seoInfo;
    }

    public function returnInfoUrl($from, $arrUri)
    {
        $url = '/info?';
        $arr = [];
        foreach ($arrUri as $key => $value) {
            $arr[] = $key . '=' . $value;
        }
        return $url . implode('&', $arr);
    }

}
